{extend name="$_admin_layout"}

{block name="tpl_vars"}
    {eq name="_request_action" value="create"}
        {php}$page_title = '新建商品';{/php}
    {else /}
        {php}$page_title = '修改商品：' . $goods_info['title'];{/php}
    {/eq}
{/block}

{block name="main-content"}
    <form id="goods_form" class="form form-manager">
        <div class="box box-blue-hoki no-heading">
            <div class="box-body">

                <div class="row">
                    <div class="col-sm-12">
                        {:helper('admin/form')->render_group('cid', $goods_info['cid'], 'select', '分类', null, array('list' => 'model://shop/category?field=id,title&order=sort,id'))}
                        {:helper('admin/form')->render_group('title', $goods_info['title'], 'text', '标题')}
                        {:helper('admin/form')->render_group('cover', $goods_info['cover'], 'image', '封面')}
                        {:helper('admin/form')->render_group('images', $goods_info['images'], 'image', '图集', null, array('data-max-file-count' => 10))}
                        {:helper('admin/form')->render_group('content', $goods_info['content'], 'html', '内容')}
                        {:helper('admin/form')->render_group('sort', $goods_info['sort'], 'text', '排序')}
                        {:helper('admin/form')->render_group('status', $goods_info['status'], 'status', '状态')}
                        {:helper('admin/form')->render_submit_and_cancel(request()->url(), $_controller->url('index'))}

                        <script type="text/javascript">
                            $(function(){
                                $('#goods_form').bootstrapValidator({
                                    fields: {
                                        cid: {
                                            validators: {
                                                notEmpty: {
                                                    message: '分类不能为空',
                                                },
                                            },
                                        },
                                        title: {
                                            validators: {
                                                notEmpty: {
                                                    message: '标题不能为空',
                                                },
                                            },
                                        },
                                    },
                                });
                            });
                        </script>
                    </div>
                </div>

            </div><!-- /.box-body -->
        </div><!-- /.box -->
    </form>
{/block}